<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
<%@ page language="java" import="java.sql.*"%>
<%@page import="model.News"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- includes -->
<%@ include file="../includes/includes.jsp"%>
<!-- fin includes -->
<title>Insertando registro ....</title>
</head>
<body>
<!-- menu  -->
<%@ include file="../includes/header.jsp"%>
<!--  fin menu  -->

<div id="main">
<center>

<%
    // add_res.jsp // form data
    //String user = request.getParameter("user");
    String tittle = request.getParameter("tittle");
    String date = request.getParameter("date");
    String body = request.getParameter("EditorDefault");
    String about = request.getParameter("about");
    String category = request.getParameter("category");
    String author = request.getParameter("author"); // database parameters


    boolean resultado = false;
    News n = new News();

    if( category==null ) category="1";

    resultado = n.addNews(tittle,body ,date , author , category);

    if (resultado) {
        out.println("Entrada añadida correctamente ....");
        out.println("<br><br><a href='addnews.jsp'>Añadir otra noticia</a> | <a href='../index.jsp'>Home</a>");
    } else {
        out.println("Error!!!!! . Intentalo de nuevo");
    } // close connection

%>
</center>
</div>

<!-- menu  -->
<%@ include file="../includes/menu.jsp"%>
<!--  fin menu  -->

<!-- menu  -->
<%@ include file="../includes/footer.jsp"%>
<!--  fin menu  -->
</body>
</html>